# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Héctor Molinero Fernández <hector at molinero dot dev>
# Contributor: Erazem Kokot <contact at erazem dot eu>

pkgname=hblock
pkgver=3.4.2
pkgrel=1
pkgdesc='Adblocker that creates a hosts file from multiple sources'
arch=('any')
url='https://hblock.molinero.dev/'
license=('MIT')
depends=('sh' 'curl' 'systemd')
makedepends=('git')
_commit='53e2755f3322db3b3e6d1f32ccb5490eb2e1e0ee'
source=("$pkgname::git+https://github.com/hectorm/hblock#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

check() {
  cd "$pkgname"

  make test
}

package() {
  cd "$pkgname"

  make DESTDIR="$pkgdir" prefix='/usr' install

  # documentation
  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
  cp -vr resources/alt-formats "$pkgdir/usr/share/doc/$pkgname"

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE.md
}
